<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<!-- 组建实例 -->
    <div id="app">
        <cpn></cpn>
        <cpn></cpn>
        <cpn></cpn>
        {{message}}
    </div>

    <template id="cpn1">
        <div>
            <h2>当前计数：{{counter}}</h2>
            <button @click="increment">+</button>
            <button @click="decrement">-</button>
        </div>
        
    </template>


    <script src="../js/vue.js"></script>
    <script>
        // 注册全局组件
        Vue.component('cpn',{
            template:'#cpn1',
            // data是一个函数
            data(){
                return{
                    counter:0
                }
            },
            methods:{
                increment(){
                    this.counter++
                },
                decrement(){
                    this.counter--
                }
            }
        })
        const app = new Vue({
            el:'#app',
            data:{
                message:'你好呀！',
                
            }
        })
        
    </script>

    <script>
        const obj = {
            name:'听',
            age:18,
        }

        function abc(){
            return obj
        }
        // function abc(){
        //     return{
        //         name:'听',
        //         age:18,
        //         sex:'男'
        //     }
        // }

    let obj1 = abc();
    let obj2 = abc();
    let obj3 = abc();

    obj1.name = "kobe"
    console.log(obj1,obj2,obj3)

    </script>
</body>
</html>